package de.sane.manager

import scala.swing._
import de.sane.recommender._
import event._

trait Manager[T] {
	this: Publisher =>
	
	def initial(): T
	
	private var _value: T = initial
	
	def transform(func: T => T): Manager[T] = {
		this._value = func(this._value)
		publish(ChangeEvent[T](this._value))
		this
	}
	
	def value(): T = {
		this._value
	}

}

case class ChangeEvent[T](value: T) extends Event

